$(document).ready(function () {
  var url = 'http://127.0.0.1:8080/homework_war_exploded/';
  $("#btn").click(function () {
    var name = $("#name").val();
    var pwd = $("#pwd").val();
    var role = $("input[name='role']:checked").val();
    $.ajax({
      type: "post",
      url: url + 'user/userdata.do',
      dataType: "json",
      data: {
        user_account: name,
        user_pwd: pwd,
        user_role: parseInt(role)
      },
      success: function (v) {
        if(v.success){
          layer.alert("登录成功!");
          window.open("http://www.baidu.com");
        }else {
          layer.alert(v.message);
        }
      }
    })
  });
});

/*

function dj() {
  var name = document.getElementById("name").value;
  var pwd = document.getElementById("pwd").value;
  
}
*/
